Looping Level Sections


"Level Boundaries" not only set the beginning and ending/upper and lower extents that a Player and his screen can progress in a level, but they can also be used to set the beginning and end/top and bottom of a looping section of the level.

Any section of a level can be made to loop on the X and/or Y axis. When looping is active, the beginning of the given level section will be repeated at the end, and the end will be repeated at the beginning. Players and Objects will "wrap around" once they cross either border- if they cross the end, their position will be adjusted so that they are moved to the beginning, and if they cross the beginning, their position will be adjusted so that they are moved to the end. The area will appear to repeat forever until looping is disabled and new boundaries are set.

Although Level/Loop Boundaries can be set at any point in the level (pixel by pixel), it's recommended that they be set at the beginning of the first tile, and the beginning of the tile that comes directly after the last one (the boundary positions should be divisible by 8).

Other important notes:


Level looping is controlled by the following "Game Variables":
  23 - LevelBound_X1[0]
  24 - LevelBound_X1[1]
  25 - LevelBound_Y1[0]
  26 - LevelBound_Y1[1]
  27 - LevelBound_X2[0]
  28 - LevelBound_X2[1]
  29 - LevelBound_Y2[0]
  30 - LevelBound_Y2[1]

  31 - Target_LevelBound_X1[0]
  32 - Target_LevelBound_X1[1]
  33 - Target_LevelBound_Y1[0]
  34 - Target_LevelBound_Y1[1]
  35 - Target_LevelBound_X2[0]
  36 - Target_LevelBound_X2[1]
  37 - Target_LevelBound_Y2[0]
  38 - Target_LevelBound_Y2[1]

  39 - XLoop_Active[0]
  40 - XLoop_Active[1]
  41 - YLoop_Active[0]
  42 - YLoop_Active[1]

  43 - BGOffsetX[0]
  44 - BGOffsetX[1]
  45 - BGOffsetY[0]
  46 - BGOffsetY[1]

  47 - XLoop_Size[0]
  48 - XLoop_Size[1]
  49 - YLoop_Size[0]
  50 - YLoop_Size[1]
These values may be set manually, but it is recommended that they be set by use of the _Player_SetTargetBounds" Script Command.